﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace Summerset.Isbndb.Authors
{


    /// <summary>
    /// The 'authors' collection provides information about book authors. 
    /// To retrieve corresponding books you can use 'person_id' to search in the books collection.
    /// Note: There is currently no distinction about roles a person played in the creating of a book (author/editor/illustrator/etc). 
    /// This may change in the future.    
    /// </summary>
    public static class AuthorsArgs
    {

        /// <summary>
        /// Gets an array of strings containing the valid indexes for the Authors collection.
        /// </summary>
        public static string[] GetValidIndexArguments()
        {

            return typeof(Arguments)
                .GetFields(BindingFlags.Public | BindingFlags.Static)
                .Select(fi => fi.GetRawConstantValue().ToString())
                .ToArray();

        }

        /// <summary>
        /// Gets an array of strings that contain the additional Results that can be requested from the authors collection.
        /// </summary> 
        public static string[] GetValidResultArguments()
        {

            return typeof(Results)
                .GetFields(BindingFlags.Public | BindingFlags.Static)
                .Select(fi => fi.GetRawConstantValue().ToString())
                .ToArray();

        }

        /// <summary>
        /// Contains string constants that are provied to the AuthorsRequest to determine what
        /// information is being requested from the Authors API.
        /// </summary>
        public static class Arguments
        {
            /// <summary>
            /// Performs a search on the author name.
            /// </summary>
            /// <remarks>
            /// The search follows the same rules and syntax as the search on the website itself -- 
            /// you can group words together using double quotes, all non-ignored words must be present in the results.
            /// </remarks>
            public const string name = "name";

            /// <summary>
            /// Retrieving author data by ISBNdb.com's person ID. Returns at most one match. 
            /// </summary>
            public const string person_id = "person_id";
        }

        /// <summary>
        /// Contains constants that can be used to request additional information 
        /// to be included in respones from the authors collection.
        /// </summary>
        public static class Results
        {

            /// <summary>
            /// Shows more details about the author. 
            /// </summary>
            public const string details = "details";

            /// <summary>
            /// Shows a list of categories this author is listed in. Typically, this shows only one category where authors are listed alphabetically.
            /// </summary>
            public const string categories = "categories";

            /// <summary>
            /// Shows a list of subjects this author has books about. You can then search for books data using 'subject_id' as a key.
            /// </summary>
            public const string subjects = "subjects";

        }

    }
}
